package com.itheima.ioTest;

import java.io.File;
import java.util.HashMap;

public class test_3 {
    public static void main(String[] args) {
        File file=new File("IO");
        HashMap<String,Integer> hm=new HashMap<>();
        getCount(hm,file);
        System.out.println(hm);
    }

    private static void getCount(HashMap<String,Integer> hm, File file) {
        File[] files = file.listFiles();
        for (File file1 : files) {
            String name = file1.getName();
            String[] split = name.split("\\.");
            if(split.length==2){
                String sp=split[1];
                if(hm.containsKey(sp)){
                    Integer count = hm.get(sp);
                    count++;
                }else {
                    hm.put(sp,1);
                }
            }
        }
    }
}
